/*
 * @description: 查看想
 * @Author: along
 * @Date: 2021-04-09
 * @Last Modified by: along
 * @Last Modified time: 2021-04-09
 */
<template>
    <div class="container uploadDetail">
        <div class="header">
            <div class="nav">
                <p class="nav_title">基础信息</p>
                <p class="nav_back" @click="() => {
                    this.$router.push({
                        name: 'Index'
                    })
                }">返回</p>
            </div>
            <div class="view">
                <div class="view_item">
                    批次组名称: <p class="view_content">{{ pageInfo.title ? pageInfo.title : '--' }}</p>
                </div>
                <div class="view_item">
                    最近提交时间: <p class="view_content">{{ pageInfo.video_submit_time * 1000 | dateFormatter('yyyy/MM/dd HH:mm') }}</p>
                </div>
                <div class="view_item">
                    任务状态: <p class="view_content">{{ pageInfo.status == 1 ? '已领取' : pageInfo.status == 2 ? '已完成' : pageInfo.status == -1 ? '未完成' : '--' }}</p>
                </div>
                <div class="view_item">
                    寝室性别: <p class="view_content">{{ pageInfo.series_sex | filterSex }}</p>
                </div>
            </div>
        </div>
        <div :style="{width: '100%', minHeight: '12px', background: 'rgba(240, 242, 245, 1)'}"></div>

        <!-- 完成情况 -->
        <div class="_secend">
            <div class="_secend_header">
                <p class="_secend_title">完成情况</p>
            </div>
            <div class="_secend_wrap">
                <div class="_items">
                    <p class="_items_title">{{ pageInfo.video_student_audit_submit_count | filterNumber }}/{{ pageInfo.room_series_count | filterNumber }}</p>
                    <p class="_items_line"></p>
                    <p class="_items_content">有效视频数/目标视频数</p>
                </div>
                <div class="_items">
                    <p class="_items_title">{{ pageInfo.video_student_audit_wait_count | filterNumber }}</p>
                    <p class="_items_line"></p>
                    <p class="_items_content">待审核视频数</p>
                </div>
                <div class="_items">
                    <p class="_items_title">{{ pageInfo.video_student_audit_fail_count | filterNumber }}</p>
                    <p class="_items_line"></p>
                    <p class="_items_content">未通过视频数</p>
                </div>
                <div class="_items">
                    <p class="_items_title">{{ pageInfo.video_student_audit_submit_count | filterNumber }}</p>
                    <p class="_items_line"></p>
                    <p class="_items_content">提交视频总数</p>
                </div>
                <div class="_items">
                    <p class="_items_title">{{ pageInfo.video_score | filterNumber }}</p>
                    <p class="_items_line"></p>
                    <p class="_items_content">总分数</p>
                </div>
            </div>
        </div>
        <div :style="{width: '100%', minHeight: '12px', background: 'rgba(240, 242, 245, 1)'}"></div>

        <!-- 公司信息 -->
        <div class="_batch">
            <div class="_batch_header">
                <p class="_batch_title">公司信息</p>
            </div>
            <div class="_bacth_box">
                <el-table
                    :data="tableData"
                    height="100%"
                    style="width: 100%;height:100%"
                    border
                >
                    <el-table-column
                        type="index"
                        width="80"
                        label="序号"
                        align="center"
                    />
                    <el-table-column
                        prop="company_name"
                        label="公司名称"
                        show-overflow-tooltip
                        :formatter="emptyFormatter"
                        align="left"
                    />
                    <el-table-column
                        prop="series_title"
                        label="产品名称"
                        show-overflow-tooltip
                        :formatter="emptyFormatter"
                        align="left"
                    />
                    <el-table-column
                        prop="series_index"
                        label="批次"
                        show-overflow-tooltip
                        :formatter="emptyFormatter"
                        align="left"
                    />
                    <el-table-column
                        prop="video_score"
                        label="分数"
                        show-overflow-tooltip
                        :formatter="emptyFormatter"
                        align="left"
                    />
                    <el-table-column
                        label="操作"
                        show-overflow-tooltip
                        :formatter="emptyFormatter"
                        align="left"
                    >
                        <template slot-scope="scope">
                            <el-button
                                type="text"
                                @click="handleCheckVideo(scope.row)"
                            >
                                查看视频
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </div>
            <!-- /分页 -->
            <div class="pagination-wrapper clearfix">
                <el-pagination
                    background
                    layout="total, prev, pager, next, jumper"
                    :current-page.sync="page.now_page"
                    :total="page.total_count"
                    :page-size="page.page_size"
                    @current-change="getTableData"
                />
            </div>
        </div>
    </div>
</template>

<script>
export default {
    components: {
    },
    data () {
        return {
            series_no: '',
            page: {
                now_page: 1,
                total_count: 0,
                page_size: 0
            },
            tableData: [{}],
            pageInfo: {
                video_student_audit_not_submit_count: '',
                room_series_count: '',
                video_student_audit_pass_count: '',
                video_score: '',
                series_school_name: '',
                video_submit_time: '',
                video_student_audit_wait_count: '',
                status: '',
                video_student_audit_submit_count: '',
                title: '',
                video_student_audit_fail_count: '',
                series_sex: ''
            }
        };
    },
    filters: {
        filterSex (val) {
            if(val === 0) return '不限';
            if(val === 1) return '男';
            if(val === 2) return '女';
            return '--';
        },
        filterNumber (val) {
            if(!val) return 0;
            return val;
        }
    },
    mounted () {
        this.series_no = this.$route.query.series_no ? this.$route.query.series_no : '';
        this.$store.commit('header/SET_HEADER', [{ title: "寝室视频上传", path: '/'}, { title: "查看详情"}]);
        this.getTableData();
        this.getInfo();
    },
    methods: {
        /**
         * @description 获取表格数据
         */
        getTableData (page) {
            this.loading = true;
            this.$post('/stuhire_room_series/Series/getLinkHireList', {
                page_id: page || this.page.now_page,
                series_no: this.series_no
            }, resp => {
                if (resp.code == 1) {
                    this.tableData = resp.data.list;
                    this.page.now_page = resp.data.page.now_page;
                    this.page.total_count = resp.data.page.total_count;
                    this.page.page_size = resp.data.page.page_size;
                    setTimeout(() => {
                        this.loading = false;
                    },300);
                }
            });
        },
        /**
         * @description 获取基础信息数据
         */
        getInfo () {
            this.$post('/stuhire_room_series/Series/getInfo', {
                series_no: this.series_no
            }, resp => {
                if (resp.code == 1) {
                    this.pageInfo = {
                        ...resp.data
                    };
                }
            });
        },

        /**
         * @description 查看视频
         */
        handleCheckVideo (row) {
            this.$router.push({
                name: 'uploadInfo',
                query: {
                    series_no: row.series_no,
                    type: this.pageInfo.status === 2 ? 'check' : 'error',
                    info: JSON.stringify({
                        company_name: row.company_name,
                        series_index: row.series_index
                    })
                }
            });
        },

        /**
         * @description 阻止默认事件
         */
        stop (row) {
            this.video_no = row.video_no;//记录id
        },

        /**
         * @description 过滤函数
         */
        emptyFormatter(row, column, val) {
            if (!val) return '--';
            return val;
        }
    }
};
</script>

<style lang="less" scoped>
.container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overflow-y: auto;
    &::-webkit-scrollbar {
        width: 4px;
    }
    .header {
        width: 100%;
        .nav {
            width: 100%;
            height: 66px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            box-sizing: border-box;
            padding: 0 24px;
            border-bottom: 1px rgba(240, 242, 245, 1) solid;
            .nav_title {
                color: rgba(51, 51, 51, 1);
                font-size: 18px;
                font-weight: 500;
            }
            .nav_back {
                color: rgba(51, 51, 51, 1);
                font-size: 14px;
                cursor: pointer;
                &:hover {
                    color: rgba(24, 144, 255, 1);
                }
            }
        }
        .view {
            width: 100%;
            display: flex;
            flex-wrap: wrap;
            box-sizing: border-box;
            padding: 24px 35px 4px 35px;
            .view_item {
                width: calc((100% - 79px) / 4);
                display: flex;
                color: rgba(136, 136, 136, 1);
                font-size: 14px;
                align-items: center;
                margin-bottom: 20px;
                .view_content {
                    color: rgba(51, 51, 51, 1);
                    font-size: 14px;
                    padding-left: 8px;
                }
            }
        }
    }

    ._secend {
        width: 100%;
        min-height: 226px;
        ._secend_header {
            width: 100%;
            height: 66px;
            box-sizing: border-box;
            padding-left: 24px;
            display: flex;
            align-items: center;
            border-bottom: 1px rgba(240, 242, 245, 1) solid;
            ._secend_title {
                color: rgba(51, 51, 51, 1);
                font-size: 18px;
                font-weight: 500;
                margin-right: 10px;
            }
        }
        ._secend_wrap {
            box-sizing: border-box;
            padding: 12px;
            display: flex;
            align-items: center;
            ._items {
                flex: 1;
                display: flex;
                flex-direction: column;
                align-items: center;
                ._items_title {
                    height: 32px;
                    line-height: 32px;
                    color: rgba(0, 0, 0, 0.8);
                    font-size: 30px;
                    font-weight: 500;
                    margin-top: 20px;
                    margin-bottom: 12px;
                }
                ._items_line {
                    width: 120px;
                    height: 1px;
                    background: rgba(235, 238, 245, 1);
                    margin-bottom: 12px;
                }
                ._items_content {
                    color: rgba(51, 51, 51, 1);
                    font-size: 14px;
                }
            }
        }
    }

    ._batch {
        width: 100%;
        box-sizing: border-box;
        min-height: 434px;
        display: flex;
        flex-direction: column;
        flex: 1;
        ._batch_header {
            width: 100%;
            height: 66px;
            box-sizing: border-box;
            padding-left: 24px;
            display: flex;
            align-items: center;
            border-bottom: 1px rgba(240, 242, 245, 1) solid;
            ._batch_title {
                color: rgba(51, 51, 51, 1);
                font-size: 18px;
                font-weight: 500;
                margin-right: 10px;
            }
        }
        ._bacth_box {
            margin: 24px;
            margin-bottom: 0px;
            flex: 1;
            min-height: 288px;
            // border: 1px red solid;
            box-sizing: border-box;
        }
    }

    ._dialog {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        ._dialog_logo {
            width: 48px;
            height: 48px;
        }
        ._dialog_title {
            color: rgba(51, 51, 51, 1);
            font-size: 16px;
            font-weight: 500;
            margin: 16px 0;
        }
        ._dialog_desc {
            color: rgba(153, 153, 153, 1);
            font-size: 14px;
            margin-bottom: 28px;
        }
        ._dialog_foot {
            width: 100%;
            height: 36px;
            display: flex;
            justify-content: center
        }
    }
    /* 分页 */
    .pagination-wrapper {
        padding-top: 16px;
        padding-bottom: 16px;
        padding-right: 24px;
        .el-pagination {
            float: right;
            padding: 0;
            background-color: transparent;
        }
    }
}
</style>

<style lang="less">
.uploadDetail {
    .el-radio {
        margin-right: 20px;
    }
    .__dialog {
        .el-dialog__body {
            padding-top: 0px;
        }
    }
    .el-radio-button__inner {
        font-weight: 400;
    }
    .is-active {
        .el-radio-button__inner {
            font-weight: 500;
        }
    }
    .el-radio-button__orig-radio:checked+.el-radio-button__inner {
        background-color: rgba(230, 241, 252, 1);
        color: rgba(32, 160, 255, 1);
        border: 1px rgba(32, 160, 255, 1) solid;
        box-shadow: none;
        border-left: 1px rgba(32, 160, 255, 1) solid;
        animation: initBord .3s linear;
    }
    @keyframes initBord {
        0% {
            border-left: 1px #DCDFE6 solid;;
        }
        100% {
            border-left: 1px rgba(32, 160, 255, 1) solid;
        }
    }
}
</style>